package cn.vendcommon.com.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * ThreadLocal 工具类
 */
@SuppressWarnings("all")
public class ThreadLocalUtil {
    //提供ThreadLocal对象,
    private static final ThreadLocal<Map<String, Object>> THREAD_LOCAL = new ThreadLocal();

    //根据键获取值
    public static Map<String, Object> get() {
        return THREAD_LOCAL.get();
    }

    //存储键值对
    public static void set(Map<String, Object> claims) {
        THREAD_LOCAL.set(claims);
    }


    //清除ThreadLocal 防止内存泄漏
    public static void remove() {
        THREAD_LOCAL.remove();
    }
}
